package
{
	import com.ixd.chenyin.events.SoundEvent;
	import com.ixd.chenyin.soundutils.SoundManager;
	import com.ixd.chenyin.soundutils.SoundUtils;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * @author:chenyin
	 * @E-mail: [email=chenyin151@163.com]chenyin151@163.com[/email]
	 * 创建时间：2016-6-15 下午4:49:22
	 * 
	 */
	public class Main extends Sprite
	{
		public function Main()
		{
			if(stage)
				init();
			else
				this.addEventListener(Event.ADDED_TO_STAGE,init);
		}
		
		private function init(e:Event = null):void
		{
			loadMusic();
		}
		
		private function loadMusic():void
		{
			var soundPaths:Vector.<Object> = Vector.<Object>([{name:SoundUtils.CREATE_MUSIC,music:"sound/game_create_char.mp3"},{name:SoundUtils.READY_GO_MUSIC,music:"sound/ReadyGo.mp3"},
				{name:SoundUtils.GAME_MUSIC,music:"sound/game.mp3"},{name:SoundUtils.COUNT_DOWN_MUSIC,music:"sound/4s_count_down.mp3"},
				{name:SoundUtils.BTN_MUSIC,music:"sound/btnMusic.mp3"},{name:SoundUtils.C_MUSIC,music:"sound/correct.mp3"},
				{name:SoundUtils.W_MUSIC,music:"sound/wrong.mp3"},{name:SoundUtils.SCORE_MUSIC,music:"sound/gameover.mp3"},
				{name:SoundUtils.RANK_MUSIC,music:"sound/rank.mp3"},{name:SoundUtils.TITLE_SOUND,music:"sound/title.mp3"},
				{name:SoundUtils.SNO_SOUND,music:"sound/sno.mp3"},{name:SoundUtils.SN1_SOUND,music:"sound/sn1.mp3"},
				{name:SoundUtils.SN2_SOUND,music:"sound/sn2.mp3"},{name:SoundUtils.SN3_SOUND,music:"sound/sn3.mp3"},
				{name:SoundUtils.SVO_SOUND,music:"sound/svo.mp3"},{name:SoundUtils.SV1_SOUND,music:"sound/sv1.mp3"},{name:SoundUtils.SV2_SOUND,music:"sound/sv2.mp3"},
				{name:SoundUtils.SV3_SOUND,music:"sound/sv3.mp3"}]);
			SoundManager.getInstance().path = soundPaths;
			SoundManager.getInstance().startLoad();
			SoundManager.getInstance().play(SoundUtils.GAME_MUSIC,0);
			SoundManager.getInstance().play(SoundUtils.CREATE_MUSIC,0);
			SoundManager.getInstance().play(SoundUtils.SN1_SOUND,0);
			SoundManager.getInstance().addEventListener(SoundEvent.SOUND_LOADED,function():void{

			});
		}
	}
}